home *** CD-ROM | disk | FTP | other *** search
/ Night Owl 6 / Night Owl's Shareware - PDSI-006 - Night Owl Corp (1990).iso / 037a / wedits22.zip / WEVARS.PAS < prev    next >
Pascal/Delphi Source File  |  1991-08-15  |  8KB  |  198 lines

  1. UNIT WEVars;
  2. { -- This is the Global Variables and Types unit of WWIVEdit 2.2
  3.   -- Last updated : 8/15/91
  4.   -- Written By:
  5.   --   Adam Caldwell
  6.   --
  7.   -- This code is Public Domain.
  8.   --
  9.   -- }
  10. {$R-,V-,S-,B-,E-,N-}   { These Optomize things as much as possible }
  11.  
  12. INTERFACE
  13.  
  14. TYPE
  15. { These are the Editor functions that I have defined so far [None..DelEOL]
  16.   If you want to add another one, give it an identifier, define a Key for it
  17.   (which will probably have to be an ALT Key or Function key because almost
  18.   all of the control keys are full), and put that definition in GetFun().
  19.   You then have to add it to the case statement in EditText().
  20. }
  21.   EdFun = (
  22.           None, Up, Down, Left, Right, WordLeft, WordRight, BackSpace,
  23.           DelChar, DelLine, Tab, Home, _End, Top, Bottom, InsLine,
  24.           ToggleInsert, PgUp, PgDn, Enter, WWIVColor, InsertLiteral,
  25.           CenterLine, GetHelp, AbortPost, ExitAndSave, NormalExit,
  26.           InsertChar, InsertFile, QuietExitAndSave, GoBack, EraseWordLeft,
  27.           MarkStart, MarkEnd, DeleteBlock, MoveBlock, CopyBlock,
  28.           ShowBlockStat, Jump, Find, SaveAndContinue, ToggleWhere,
  29.           DelSOL, FindLast, RedisplayAll, InsertMCI, ToggleFullScreen,
  30.           DelEOL
  31.           );
  32.  
  33.  
  34. CONST
  35.   VERSION = 'Version 2.2';
  36.   TabStop=5;
  37.   MinScrollLeft = 3;
  38.   AbsoluteMaxLines = 3300;
  39.   MaxPhyLines = 50;
  40.   MaxLineLen = 80;
  41.   WarnTime = 90.0;              { Number of seconds before user should be warned }
  42.   DisconnectTime = WarnTime * 2;
  43.   NormalReturnCode       = 0;   { The result code for '/ES' and ESC-S }
  44.   NonAnonymousReturnCode = -1;  { The result code for '/ESN' }
  45.   AnonymousReturnCode    = 1;   { The result code for '/ESY' }
  46.  
  47. {-- It is assumed that the COMMON.PAS takes care of these Macro keys, and they
  48.  -- are defined here only so that I can remember that they are already in use }
  49.  
  50.   MacroKey1   = ^D;  MacroKey2   = ^F;  MacroKey3   = ^A;
  51.  
  52.   FastLeft    = ^S; FastRight   = ^E;
  53.   DelWordLeft = ^W;
  54.   BackSpaceKey= ^H;  _DEL_       = #127;
  55.   ESC         = #27;
  56.  
  57.   RedisplayKey= ^R;  DelLineKey  = ^Y;  TabKey      = ^I;
  58.                      UpKey       = ^U;  PgUpKey     = ^T;
  59.   LeftKey     = ^G;                     RightKey    = ^Z;
  60.                      DownKey     = ^J;  PgDnKey     = ^B;
  61.   ToggleInsKey= ^V;  DelKey      = #127;
  62.  
  63.   RepeatLastFindKey = ^L;
  64.  
  65.   DelLeftKey  = ^N;  ToggleFullscreenKey=^];
  66.  
  67.   EnterKey         = ^M;  WWIVColorKey     = ^P;
  68.   ExtendedKey2     = ^Q;  CenterLineKey    = ^C;
  69.   DelSOLKey        = ^X;  HelpKey          = ^O;
  70.  
  71.   ExtendedKey1     = ^K;
  72.  
  73.   EditorKeys : SET OF Char = [FastLeft, FastRight, BackSpaceKey, _DEL_,
  74.                  DelLineKey, TabKey, UpKey, PgUpKey, LeftKey, ToggleInsKey,
  75.                  RightKey, DownKey, PgDnKey, DelKey, RedisplayKey, RepeatLastFindKey,
  76.                  EnterKey, WWIVColorKey, CenterLineKey, DelSOLKey, HelpKey,
  77.                  DelLeftKey, DelWordLeft, ExtendedKey1, ExtendedKey2,
  78.                  ToggleFullScreenKey];
  79.  
  80. TYPE
  81.   strng = string[MaxLineLen+1];
  82.   linetype = RECORD  { Each line has a color map and a text part }
  83.     l : strng;
  84.     HardCR : Boolean;
  85.     c : strng;
  86.   END;
  87.  
  88.   textbuffer = ARRAY[0..AbsoluteMaxLines] of ^linetype; { The Text buffer is
  89.                                                         allocated from the heap }
  90.   screenbuffer = ARRAY[0..MaxPhyLines] OF linetype;
  91.  
  92.   ExtTrans = array[1..3] OF char;
  93.   TransFile = FILE of ExtTrans;
  94.   CharSet = SET of Char;
  95.   PROC = PROCEDURE;
  96.   userrec = record
  97.     name     : string[30];     { User's Handle                             }
  98.     realname : string[20];     { User's Real Name                          }
  99.     sl       : byte;           { Security Level                            }
  100.   END;
  101.  
  102.  
  103.   CharFunction = FUNCTION : char;
  104.  
  105.   InfoRec = RECORD
  106.     UserName : string[20];
  107.     TagLine  : ARRAY[1..3] OF String[80];
  108.     Selected : Byte;  { Which was last attached }
  109.     Method   : Byte;  { 0=No Tag Line, 1, 2, 3=Always use #1, #2, or #3,
  110.                         4=Rotate, 5=Random, 6=Method=Selected on next use }
  111.     ScreenState : Byte;
  112.     ScreenHeight : Byte;
  113.     InsertMode : Boolean;
  114.     Reserved : ARRAY[1..131] OF byte;
  115.   END;
  116. { -- Programmer's Note on INFOREC --
  117.   -- If you add anything to this, add it after the reserved bytes,
  118.   -- and decrement the reserved bytes accordingly.  Future version of
  119.   -- WWIVEdit will add new things before Reserved, and decrement the bytes
  120.   -- accordingly... So to be the most compatible with future version,
  121.   -- Add after the Reserved
  122.   -- }
  123.  
  124.   InfoF = FILE of InfoRec;
  125.  
  126.  
  127. VAR
  128.   screen : ScreenBuffer; { An image of what should appear on the screen }
  129.   line : TextBuffer;     { The physical text }
  130.   MaxLines : integer;    { The Maximum number of lines as passed on command line }
  131.   LineLen : integer;     { The Maximum line length as passed on command line }
  132.   cx, cy : integer;      { The x and y coords of the cursor }
  133.   WindowTop : integer;   { defines the Window Top -- physical screen line }
  134.   WindowBottom : integer;{ defines the Window Bottom -- physical screen line }
  135.   ViewTop : integer;     { defines the Viewport Top -- physical Text line }
  136.   ViewBottom : integer;  { defines the Viewport Bottom -- physical Text line }
  137.   WindowHeight:integer;  { how tall the physical window is }
  138.   ScreenHeight:byte;     { the maximum height of the screen }
  139.   FileName : string;     { the name of the input/output file }
  140.   Title : string;        { the title of the mesage }
  141.   Destination : string;  { where the message is going }
  142.   CurrentColor : char;   { the color attribute to assign to the current character }
  143.   DisplayColor : char;   { The current state of ANSIC }
  144.   Local : boolean;       { defines whether ceartain functions can be used }
  145.   InsertMode : boolean;  { Whether or not we are in insert mode -- initialized true }
  146.   HighLine : integer;    { The highest line currently in use }
  147.   LastKey  : LongInt;    { used to time-out the editor }
  148.   TransTable : TransFile;{ Used for Local Extended Key Macros }
  149.   OkLocalMacros :boolean;{ If BBS.KEY and MACROS.LCL exist, local macros are ok }
  150.   OkTagLines : boolean;  { If there is no /T parameter on the command line, Tag Lines are ok }
  151.   AddBBSTag : boolean;   { If there is no /A parameter, and the file BBS.TAG exists }
  152.   FileThere : Boolean;   { If a file got loaded in at the beginning.  If so, then no tag lines are added }
  153.   BlockStart : integer;  { Block Marker Start (line number) }
  154.   BlockEnd   : integer;  { Block Marker End (line number) }
  155.   SearchString : string; { The last search string }
  156.   SearchOps : String;    { The last search options }
  157.   KeyStatusFlag : BYTE ABSOLUTE $40:$17;
  158.   ColorRangeCheck : boolean;
  159.   AfterNext : PROC;      { This is a hook into the ReadKey procedure.  This
  160.                            procedure will be executed after the next keystroke
  161.                            is accepted.  This is used to Clear the statline, but
  162.                            can have other functions }
  163.   BeforeNext: PROC;
  164.   ScreenSize : WORD ABSOLUTE $40:$4C;
  165.   ParameterFileName:string;
  166.   InfoFile : InfoF;
  167.   CMap : ARRAY[char] OF Boolean;
  168.   AddSL : Byte; { Minimum SL to add a word to the dictionary }
  169.   MCICommands : boolean;
  170.   KeyBIOS : boolean;
  171.   NoColor : boolean;
  172.   ForceAnsi : Boolean;
  173.   ScreenState : Byte;  { 0=With header and Maxlines, 1= Nothing on screen }
  174.  
  175.  
  176. VAR
  177.   usernum     : integer;        { Current user's number                     }
  178.   incom       : boolean;        { TRUE if user is calling remotely          }
  179.   thisuser    : userrec;        { Contains all pertinent user info          }
  180.   IgnoreName  : boolean;
  181.   translate   : boolean;        { If true, translates WWIV Color codes to   }
  182.                                 { ANSI codes.  If WWIV is detected then     }
  183.                                 { this will initially be false, otherwise T }
  184.   Info : InfoRec;
  185.   FG, BG      : byte;           { Foreground and Background colors          }
  186.   StartupDir  : string;         { The directory the program started up in   }
  187.   AllowTitleChange : Boolean;
  188.   InDos : Boolean;
  189.   DicChanged  : Boolean;
  190.   Suggestion : ARRAY [1..100] OF string[25];
  191.  
  192. PROCEDURE DoNothing;
  193.  
  194. IMPLEMENTATION
  195.  
  196. {$F+} PROCEDURE DoNothing; BEGIN END; {$F-}
  197.  
  198. END.